import 'package:flutter_smart_heating/common/app.dart';
import 'package:flutter_smart_heating/common/http.dart';
import 'package:flutter_smart_heating/ui/ui.dart';
import 'package:get/get.dart';

import 'state.dart';

class FeedbackLogic extends GetxController {
  final state = FeedbackState();

  submit() async {
    state.loading = true;
    update(['submit']);
    var res = await Http.instance.post('/plugin/feedback/api/submit', data: {
      "content": state.content,
      "attachment": state.attachment,
    });
    if (res.code == 1) {
      App.back(Get.context, result: 'success');
    }
    Ui.toast(res.msg);
    state.loading = false;
    update(['submit']);
  }
}
